﻿<Window x:Class="CPPEI.Coolzon.Designer.Views.DataSourceWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:local="clr-namespace:CPPEI.Coolzon.Designer.Views"
        xmlns:dataSource="clr-namespace:CPPEI.Coolzon.ServiceProxy.DesignServiceRef;assembly=CPPEI.Coolzon.ServiceProxy"
        mc:Ignorable="d"
        Title="数据源" Height="433" Width="866" Loaded="Window_Loaded" WindowStartupLocation="CenterScreen" Closing="Window_Closing"
          Style="{DynamicResource WindowStyle}">
    <Window.Resources>
        <local:DateTimeToString x:Key="dateTimeTostringConverter"/>
    </Window.Resources>
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="30"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>
        <StackPanel Style="{DynamicResource ButtonPanelBackground}" x:Name="_ctlSPDataSource" IsEnabled="False" Grid.Row="0" Orientation="Horizontal">
            <Button Name="_ctlAdd" Style="{DynamicResource AddButtonStyle}" FontSize="15" VerticalContentAlignment="Center" Width="36" Margin="3" ToolTip="增加" Click="_ctlAdd_Click"/>
            <Button Name="_ctlRemove" Style="{DynamicResource RemoveButtonStyle}" FontSize="15" Width="36" Margin="3" ToolTip="删除" Click="_ctlRemove_Click"/>
            <Button Name="_ctlEdit" Style="{DynamicResource EditButtonStyle}" FontSize="15" Width="36" Margin="3" ToolTip="编辑" Click="_ctlEdit_Click"/>
            <Button Name="_ctlPublish" Style="{DynamicResource ShortButtonStyle}"  Content="发布" FontSize="15" Width="36" Margin="3" ToolTip="发布" Click="_ctlPublish_Click"/>
            <Button Name="_ctlPublishAll" Style="{DynamicResource LongButtonStyle}"  Content="全部发布" FontSize="15" Margin="3" ToolTip="全部发布" Click="_ctlPublishAll_Click"/>
            <Button Name="_ctlRetry" Style="{DynamicResource LongButtonStyle}"  Content="重新获取" FontSize="15" Margin="3" ToolTip="获取失败,重新获取" Click="_ctlRetry_Click" Visibility="Collapsed"/>
        </StackPanel>
        <ListView Grid.Row="1" x:Name="_ctlDataSourceView" AlternationCount="2"  >
            <ListView.ItemContainerStyle>
                <Style TargetType="ListViewItem" BasedOn="{StaticResource {x:Type ListBoxItem}}">
                    <EventSetter Event="MouseDoubleClick" Handler="ListViewItem_MouseDoubleClick"/>
                </Style>
            </ListView.ItemContainerStyle>
            <ListView.View>
                <GridView>
                    <GridView.Columns>
                        <GridViewColumn Header="名称">
                            <GridViewColumn.CellTemplate>
                                <DataTemplate>
                                    <TextBlock Text="{Binding Path=Name}" Width="Auto" Margin="10"></TextBlock>
                                </DataTemplate>
                            </GridViewColumn.CellTemplate>
                        </GridViewColumn>
                        <GridViewColumn Header="版本">
                            <GridViewColumn.CellTemplate>
                                <DataTemplate>
                                    <TextBlock Text="{Binding Path=Version}" Width="Auto" Margin="10"></TextBlock>
                                </DataTemplate>
                            </GridViewColumn.CellTemplate>
                        </GridViewColumn>
                        <GridViewColumn Header="发布版本" >
                            <GridViewColumn.CellTemplate>
                                <DataTemplate>
                                    <TextBlock Text="{Binding Path=PublishedVersion}" Width="Auto" Margin="10"></TextBlock>
                                </DataTemplate>
                            </GridViewColumn.CellTemplate>
                        </GridViewColumn>
                        <GridViewColumn Header="发布时间">
                            <GridViewColumn.CellTemplate>
                                <DataTemplate>
                                    <TextBlock Text="{Binding Path=PublishedTime, Converter={StaticResource dateTimeTostringConverter}}" Width="Auto" Margin="10"></TextBlock>
                                </DataTemplate>
                            </GridViewColumn.CellTemplate>
                        </GridViewColumn>
                    </GridView.Columns>
                </GridView>
            </ListView.View>
        </ListView>
    </Grid>
</Window>
